package com.homedo.odin.solution.service;

import com.homedo.core.common.base.service.BaseService;
import com.homedo.odin.solution.dao.SolutionRankMapper;
import com.homedo.odin.solution.enumcode.solution.RankTypeEnum;
import com.homedo.odin.solution.enumcode.solution.SolutionExpTypeEnum;
import com.homedo.odin.solution.model.entity.SolutionRank;
import com.homedo.odin.solution.model.response.pc.solution.SolutionRankResponseBean;
import java.util.List;
import org.springframework.stereotype.Service;

/**
 * <p> 方案排行榜，热搜列表按修改时间倒序排列，取最新 N 条数据。  服务实现类 </p>
 *
 * @author ZhangLei
 * @date 2018-05-15
 * @Description:
 */
@Service
public class SolutionRankServiceImpl extends BaseService<SolutionRankMapper, SolutionRank> {

    public List<SolutionRank> querySolutionRank(Integer rankType) {
        return baseMapper.querySolutionRank(rankType);
    }

    public List<SolutionRank> querySolutionRankHot(Integer rankType) {
        return baseMapper.querySolutionRankHot(rankType);
    }

    /**
     * 获取最新精品或热搜修改
     * @param rankType
     * @return
     */
    public SolutionRank queryLateSolutionRank(Integer rankType) {
        return baseMapper.queryLateSolutionRank(rankType);
    }

    /**
     * PC_精品热搜榜
     */
    public List<SolutionRankResponseBean> hotSearchAndBoutique(Integer biztype, Integer dataSize) {
        Integer solutionExpType = null;
        if (RankTypeEnum.JINGPING.getDbValue().equals(biztype)) {
            solutionExpType = SolutionExpTypeEnum.BOUTIQUE.getDbValue();
        }
        return baseMapper.selectSolutionBybizytpeDataSize(biztype, dataSize, solutionExpType);
    }
}
